Cover the completion handler - #70
Merged
Merged
Conversation
First tests for SettexCompletionHandler, the largest file in the language server at 699 lines, the most visible feature of both editor extensions, and until now entirely untested. Seven tests covering what a user sees at each cursor position: object properties after a dot, restricted to that object rather than its siblings; declared variables and environments; the keyword list; a request for a URI the server never opened, which the client can genuinely produce and which must degrade rather than throw; and a half-written document, which must not fault. One of them records a limitation rather than a behaviour. Properties and variables both come from the evaluated AST, so while the file does not parse — which is most of the time completion is wanted — only the static keyword list is offered. The handler degrades instead of failing, but it does not help, and that is worth a test that will start failing the day someone improves it. Two assumptions I wrote down turned out to be wrong and the tests caught them before they became false assurances: property completion needs the document to parse, so the incomplete `Server.` I first wrote produced nothing; and the partial-word case does not behave as I expected at all. I removed that second test rather than weaken it into something that would pass — pinning a behaviour I had not confirmed would be a guess dressed as a check, which is the exact defect the last review found in two existing tests. This covers one of the five untested handlers. Definition, document symbol, text-document sync and watched files remain. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Premiers tests pour
SettexCompletionHandler— 699 lignes, le plus gros fichier du serveur de langage, la fonctionnalité la plus visible des deux extensions, et jusqu'ici sans aucun test.Ce qui est couvert
Sept tests sur ce qu'un utilisateur voit à chaque position du curseur : les propriétés d'un objet après un point (restreintes à cet objet, pas à ses frères), les variables et environnements déclarés, la liste de mots-clés, une requête sur un URI jamais ouvert — que le client peut réellement produire et qui doit dégrader plutôt que lever — et un document à moitié écrit, qui ne doit pas planter.
Un test qui consigne une limite, pas un comportement
Propriétés et variables viennent toutes deux de l'AST évalué. Tant que le fichier ne parse pas — c'est-à-dire la plupart du temps où l'on veut de la complétion — seule la liste statique de mots-clés est proposée. Le gestionnaire dégrade sans échouer, mais il n'aide pas.
C'est verrouillé par un test qui commencera à échouer le jour où quelqu'un l'améliorera.
Deux hypothèses fausses, attrapées avant de devenir des garanties
La complétion de propriétés exige que le document parse : le
Server.incomplet que j'avais écrit d'abord ne produisait rien.Et le cas du mot partiel ne se comporte pas du tout comme je le supposais. J'ai supprimé ce test plutôt que de l'affaiblir jusqu'à ce qu'il passe — épingler un comportement non confirmé serait une supposition déguisée en vérification, exactement le défaut que la dernière revue a trouvé dans deux tests existants.
Portée
Ceci couvre un des cinq gestionnaires sans tests. Definition, document symbol, synchronisation de document et fichiers surveillés restent à faire.
391 → 398 tests.
🤖 Generated with Claude Code